import { IsString, IsOptional, IsObject } from 'class-validator';
import { PartialType } from '@nestjs/mapped-types';

export class CreateRoleDto {
  @IsString()
  name: string;

  @IsString()
  @IsOptional()
  script_url?: string;

  @IsObject()
  @IsOptional()
  rules?: Record<string, any>;

  @IsString()
  @IsOptional()
  description?: string;
}

export class UpdateRoleDto extends PartialType(CreateRoleDto) {}

export class RoleResponseDto {
  id: number;
  name: string;
  script_url?: string;
  rules?: Record<string, any>;
  description?: string;
  created_at: Date;
  updated_at: Date;
}
